cc.Class({
    extends: cc.Component,

    properties: {
        exploitsitem_prefab: cc.Prefab,
    },

    onLoad: function () {
        this.node.setPosition(cc.p(0, -2000));
        this.node.runAction(cc.moveTo(0.2, cc.p(0, 0)));
        for (let i = 0; i < 10; i++) {
            var node = cc.instantiate(this.exploitsitem_prefab);
            var scrollView = cc.find('exploits_bg/scrollView/view/content', this.node);
            scrollView.setContentSize(scrollView.getContentSize().width,
                                        scrollView.getContentSize().height + 160);
            // node.getComponent("exploitsitem_component").game_time = message.historyItems[i].time;
            // node.getComponent("exploitsitem_component").game_room = message.historyItems[i].roomId;
            // for (let j = 0; j < message.historyItems[i].scores.length; j++) {
            //     var usernode = cc.find("user");
            //     if (usernode) {
            //         var user = usernode.getComponent("user_component");
            //         if (user.myuserdata.username === message.historyItems[i].scores[j].name) {
            //             arr.push(message.historyItems[i].scores[j].name);
            //             arr.push(message.historyItems[i].scores[j].score);
            //             node.getComponent("exploits_item_component").game_player1 = arr;
            //         } else {
            //             arr.push(message.historyItems[i].scores[j].name);
            //             arr.push(message.historyItems[i].scores[j].score);
            //             if (second === 0) {
            //                 node.getComponent("exploits_item_component").game_player2 = arr;
            //                 second++;
            //             } else {
            //                 node.getComponent("exploits_item_component").game_player3 = arr;
            //                 second = 0;
            //             }
            //         }
            //         arr.length = 0;
            //     }
            // }
            node.setPosition(cc.p(0, -node.getContentSize().height * 0.5 - i * (node.getContentSize().height + 10)));
            scrollView.addChild(node);
        }
    },

    onClose: function () {
        this.node.runAction(cc.sequence(
            cc.moveTo(0.5, cc.p(0, -2000)),
            cc.callFunc(this.exitThisNode, this)
            ));
    },
    
    //删除当前节点
    exitThisNode: function () {
        this.node.destroy();
    },
});
